# from google.appengine.api import app_identity	 import app_identity

apiKey = "AIzaSyCtVtAW9-O9ICRsaeGaWMqqAdrwA0h3za4"
scopes = ['https://www.googleapis.com/auth/mapsengine.readonly']

def index():

	return dict(apiKey=apiKey)


def getToken():

	try:
		token, x = app_identity.get_access_token(scopes)
	except:
		token = urllib2.urlopen("http://templatemapviewer.appspot.com/templatemapviewer/default/token.html").read()

	return token

	
def token():

	token, x = app_identity.get_access_token(scopes)
	
	return dict(token=token)